package com.Lixiaoqian.CardPlay.model;

/**
 * Created by Werb on 2016/8/18.
 * Werb is Wanbo.
 * Contact Me : werbhelius@gmail.com
 * Singleton Factory with retrofit
 */
public class ApiFactory {

    protected static final Object monitor = new Object();
    static UserApi userApiSingleton = null;
    static ResourceApi ResouceApiSingleton = null;

    //return Singleton
    public static UserApi getUserApiSingleton() {
        synchronized (monitor) {
            if (userApiSingleton == null) {
                userApiSingleton = new ApiRetrofit().getUserApiService();
            }
            return userApiSingleton;
        }
    }


    public static ResourceApi getResouceApiSingleton() {
        synchronized (monitor) {
            if (ResouceApiSingleton == null) {
                ResouceApiSingleton = new ApiRetrofit().getResourceService();
            }
            return ResouceApiSingleton;
        }
    }
}
